﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProjectNocturnalFool
{
    class CharacterEditOptionsPanel : PanelControl
    {
        ButtonControl backBtn, resetBtn, confirmBtn;

        public override int width
        {
            get
            {
                return base.width;
            }
            set
            {
                base.width = value;

                if (backBtn != null)
                {
                    int[] space = Util.spaceEvenX(3, backBtn.width, width);
                    backBtn.x = x + space[0];
                    resetBtn.x = x + space[1];
                    confirmBtn.x = x + space[2];
                }
            }
        }

        public override void LoadContent()
        {
            width = 100;
            height = 100;

            int prevCtrl = y + Constants.ControlOffsets;
            int alignMiddle = Util.getCentreDrawPointX(x, 100, 1);

            backBtn = new ButtonControl();
            backBtn.LoadContent();
            backBtn.yAnchor = VerticleAnchor.Bottom;
            backBtn.type = Button_Type.EditBack;
            backBtn.y = (y + height) - (backBtn.height + Constants.ControlSmallOffsets);
            backBtn.width = 45;

            resetBtn = new ButtonControl();
            resetBtn.LoadContent();
            resetBtn.yAnchor = VerticleAnchor.Bottom;
            resetBtn.type = Button_Type.EditReset;
            resetBtn.y = (y + height) - (backBtn.height + Constants.ControlSmallOffsets);
            resetBtn.width = 45;

            confirmBtn = new ButtonControl();
            confirmBtn.LoadContent();
            confirmBtn.yAnchor = VerticleAnchor.Bottom;
            confirmBtn.type = Button_Type.EditConfirm;
            confirmBtn.y = (y + height) - (backBtn.height + Constants.ControlSmallOffsets);
            confirmBtn.width = 45;

            //Generic buttons                        
            ButtonControl addBtn = new ButtonControl();
            addBtn.LoadContent();
            addBtn.xAnchor = HorizontalAnchor.Middle;
            addBtn.yAnchor = VerticleAnchor.Top;
            addBtn.type = Button_Type.EditRace;
            addBtn.y = prevCtrl;
            prevCtrl += Constants.ButtonHeight + Constants.ControlSmallOffsets;
            addBtn.x = alignMiddle;
            controls.Add(addBtn);

             addBtn = new ButtonControl();
            addBtn.LoadContent();
            addBtn.xAnchor = HorizontalAnchor.Middle;
            addBtn.yAnchor = VerticleAnchor.Top;
            addBtn.type = Button_Type.EditGender;
            addBtn.y = prevCtrl;
            prevCtrl += Constants.ButtonHeight + Constants.ControlSmallOffsets;
            addBtn.x = alignMiddle;
            controls.Add(addBtn);

            addBtn = new ButtonControl();
            addBtn.LoadContent();
            addBtn.xAnchor = HorizontalAnchor.Middle;
            addBtn.yAnchor = VerticleAnchor.Top;
            addBtn.type = Button_Type.EditAlignment;
            addBtn.y = prevCtrl;
            prevCtrl += Constants.ButtonHeight + Constants.ControlSmallOffsets;
            addBtn.x = alignMiddle;
            controls.Add(addBtn);

            addBtn = new ButtonControl();
            addBtn.LoadContent();
            addBtn.xAnchor = HorizontalAnchor.Middle;
            addBtn.yAnchor = VerticleAnchor.Top;
            addBtn.type = Button_Type.EditClass;
            addBtn.y = prevCtrl;
            prevCtrl += Constants.ButtonHeight + Constants.ControlSmallOffsets;
            addBtn.x = alignMiddle;
            controls.Add(addBtn);
                       
            addBtn = new ButtonControl();
            addBtn.LoadContent();
            addBtn.xAnchor = HorizontalAnchor.Middle;
            addBtn.yAnchor = VerticleAnchor.Top;
            addBtn.type = Button_Type.EditAbilities;
            addBtn.y = prevCtrl;
            prevCtrl += Constants.ButtonHeight + Constants.ControlSmallOffsets;
            addBtn.x = alignMiddle;
            controls.Add(addBtn);

            controls.Add(backBtn);
            controls.Add(resetBtn);
            controls.Add(confirmBtn);

            base.LoadContent();


        }

    }
}
